import pandas as pd
from tabulate import tabulate

text_unit = pd.read_parquet("./datas/demo1/output/text_units.parquet")
print(tabulate(text_unit, headers='keys', tablefmt='pretty', showindex=False, stralign='left', maxcolwidths=[20, 20, 20, 20, 20]))

#使用绝对路径读取 Parquet 文件
df_entities = pd.read_parquet('./datas/demo1/output/entities.parquet')  # 替换为实际路径
df_relations = pd.read_parquet('./datas/demo1/output/relationships.parquet')  # 替换为实际路径

print("entities")
print(tabulate(df_entities[0:5], headers='keys', tablefmt='pretty', showindex=False, stralign='left', maxcolwidths=[20, 20, 20, 20, 20]))

print("relationships")
print(tabulate(df_relations[0:5], headers='keys', tablefmt='pretty', showindex=False, stralign='left', maxcolwidths=[20, 20, 20, 20, 20]))


df_communities = pd.read_parquet('./datas/demo1/output/communities.parquet')
print(tabulate(df_communities, headers='keys', tablefmt='pretty', showindex=False, stralign='left', maxcolwidths=[20, 20, 20, 20, 20]))


df_community_reports = pd.read_parquet('./datas/demo1/output/community_reports.parquet')  # 替换为实际路径
print(tabulate(df_community_reports, headers='keys', tablefmt='pretty', showindex=False, stralign='left', maxcolwidths=[20, 20, 20, 20, 20]))
